package cn.livingCloud.controller.user;

import cn.livingCloud.dto.ImageManageListDto;
import cn.livingCloud.service.ImageUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * Created by 唐旭 on 2016/2/15.
 */
@Controller
@RequestMapping("admin/image")
public class ImageManagerController {
    @Autowired
    @Qualifier("imageUploadServiceImpl")
    private ImageUploadService uploadService;

    @RequestMapping(value = "/list.htm")
    public String list(ImageManageListDto listDto, Model model) {
        uploadService.list(listDto);
        model.addAttribute("listDto", listDto);
        return "images/list";
    }

    @RequestMapping(value = "/archive.htm")
    public String archive(String uuid, boolean target, Model model) {
        uploadService.archive(uuid, target);
        model.addAttribute("dis", "success");
        return "redirect:list.htm";
    }
}
